package project.tests;

import lejos.nxt.Button;
import lejos.nxt.LCD;
import lejos.nxt.SensorPort;
import lejos.nxt.UltrasonicSensor;

public class UltrasonidoTest {

		public static void main(String[] args) throws InterruptedException {

		UltrasonicSensor sonic = new UltrasonicSensor(SensorPort.S4);
		sonic.setMode(UltrasonicSensor.MODE_PING);
		while(!Button.ESCAPE.isDown()) {
			sonic.ping();
			
			System.out.println("distance = " + sonic.getDistance());
			Thread.sleep(500);
		}
	}
}
